#include "PluginBase.h"

#include <HLString.h>
#include <LuaManager.h>
#include <windows.h>

PluginBase::PluginBase()
{
}

PluginBase::~PluginBase()
{
}

int PluginBase::Init()
{
	LuaManager::GetInstance().GetLua().new_usertype<PluginBase>("PluginBase",
		sol::constructors<PluginBase()>(),
		"ShowMessagebox", &PluginBase::ShowMessagebox,
		"StringToHexString", &PluginBase::StringToHexString,
		"HexStringToString", &PluginBase::HexStringToString
		);
	return 1;
}

int PluginBase::Shutdown()
{
	return 1;
}

void PluginBase::ShowMessagebox(const char *msg, const char *caption)
{
	MessageBoxA(0, HL::String::UTF8ToGBK(msg).c_str(), HL::String::UTF8ToGBK(caption).c_str(), MB_OK);
}

std::string PluginBase::StringToHexString(std::string strSrc)
{
	return HL::String::StringToHexString(strSrc);
}

std::string PluginBase::HexStringToString(std::string strSrc)
{
	return HL::String::HexStringToString(strSrc);
}
